﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace PhilWicklund.com.FacebookParts
{
    public class DiscussionBoardPart: System.Web.UI.WebControls.WebParts.WebPart
    {
        private string actionText = "";
        
        protected override void CreateChildControls()
        {
            
            try
            {
                StringBuilder script = new StringBuilder();
                script.Append("<fb:serverfbml style=\"width: 100%;\">")
                    .Append("<script type=\"text/fbml\">")
                    .Append("  <fb:fbml>")
                    .Append("      <fb:board xid=\"titans_board\" ")
                    .Append("      canpost=\"true\"")
                    .Append("      candelete=\"false\"")
                    .Append("      canmark=\"false\"")
                    .Append("      cancreatetopic=\"true\"")
                    .Append("      numtopics=\"5\"")
                    .Append("      returnurl=\"http://apps.facebook.com/myapp/titans/\">")
                    .Append("<fb:title>Discuss the Titans</fb:title>")
                    .Append("</fb:board>")
                    .Append(" </fb:fbml>")
                 
                    .Append("</script>")
                  .Append("</fb:serverfbml>");

                this.Controls.Add(new LiteralControl(script.ToString()));
            }
            catch (Exception e) { this.Controls.Add(new LiteralControl(e.Message)); }
        }
    }
}
